<template>
  <div class="login-container">
    <div class="login-card">
      <h1 class="app-title">H-DOT 任务后台管理系统</h1>
      <el-form :model="form" ref="formRef" label-width="100px" class="login-form">
        <el-form-item label="账号" prop="username">
          <el-input v-model="form.username" placeholder="请输入用户名" />
        </el-form-item>
        <el-form-item label="密码" prop="password">
          <el-input type="password" v-model="form.password" placeholder="请输入密码" />
        </el-form-item>
        <el-form-item class="remember">
          <el-checkbox v-model="form.rememberMe">记住我</el-checkbox>
        </el-form-item>
       
        <el-button type="primary" class="login-button" @click="handleLogin">登录</el-button>
      </el-form>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue';

const form = ref({
  username: '',
  password: '',
  rememberMe: false,
});

const handleLogin = () => {
  // Handle login logic here
  if (form.value.rememberMe) {
    localStorage.setItem('username', form.value.username);
  } else {
    localStorage.removeItem('username');
  }
  // Add your login logic here
};
</script>

<style scoped>
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: url('@/assets/background.png') no-repeat center center fixed;
  background-size: cover;
}

.login-card {
  background: rgba(255, 255, 255, 0.95); /* Slightly transparent white */
  border-radius: 15px; /* Softer corners */
  padding: 40px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2); /* Subtle shadow for depth */
  width: 600px; /* Adjusted width for a balanced look */
  text-align: center;
}

.app-title {
  color: #333; /* Dark color for the title */
  margin-bottom: 30px;
  font-family: 'Arial', sans-serif;
  font-size: 24px; /* Larger font size for the title */
}

.login-form {
  text-align: right; /* Align form items to the left */
}

.el-form-item{
    margin-bottom: 20px;
}

.login-button {
  width: 90%;
  height: 40px;
  padding: 12px;
  font-size: 18px;
  border-radius: 5px;
  background-color: #409EFF; /* Primary color */
  color: white;
  transition: background-color 0.3s;
}

.login-button:hover {
  background-color: #66b1ff; /* Lighter shade on hover */
}

.el-input {
    --el-input-inner-height: 35px;
}

/* scoped 样式默认不会影响子组件的样式，如果你想要从一个指定的标签中查找某个子标签并应用样式，可以使用 ::v-deep() */
::v-deep(.remember .el-form-item__content){
  justify-content: flex-end;
  padding-right: 10px;
}

</style>

